<template>
  <MyDemo ref="demo" />
</template>

<script setup name="App">
import { onMounted, ref, watchEffect } from 'vue'
import MyDemo from './components/MyDemo'

const demo = ref(null)

watchEffect(() => {
  // 或者使用watchPostEffect就不用if判断了
  if (demo.value) {
    const { a, b } = demo.value // 解构赋值也动态响应
    // console.log(demo.value.a);
    // console.log(demo.value.b);
    console.log(a, b);
  }
})
</script>

<style>
</style>
